package com.lanyuan.util;

import java.io.File;
import java.io.IOException;

import org.springframework.web.multipart.MultipartFile;

public class FileUploadUtil {

	public static String savePicToPath(String path, String filename, String extensionName, MultipartFile file) {
		String fileFullName = filename + "." + extensionName;
		File targetFile = new File(path, fileFullName);
		if (!targetFile.exists()) {
			targetFile.mkdirs();
		}
		try {
			file.transferTo(targetFile);
		} catch (IOException e) {
			return null;
		}
		return fileFullName;
	}
}
